@model SharedPageVM

@{
    ViewData["Title"] = "Discover draw";
    if (ViewData["Nickname"] != null)
    {
        ViewData["Title"] = ViewData["Nickname"] + " draw";
    }

    var uinfo = Netnr.Blog.Web.Apps.LoginService.Get(ViewContext.HttpContext);
    var rows = Model.Rows as List<Netnr.Blog.Domain.Draw>;

    string ca = ViewContext.RouteData.Values["controller"].ToString().ToLower() + "/" + ViewContext.RouteData.Values["action"].ToString().ToLower();
    string rid = ViewContext.RouteData.Values["id"]?.ToString().ToLower();
}

<style>
    .stool {
        display: none;
    }

    .table tr:hover .stool {
        display: inline-block;
    }
</style>

<div class="container">
    <div class="row">
        <div class="col-12 mt-5 mb-2">
            @if (ca == "user/index" && uinfo.UserId.ToString() == rid)
            {
                <a class="float-right" href="/draw/code/form">Add</a>
            }
            We’ve found <b>@Model.Pag.Total.ToString("N0")</b> results
        </div>
        @if (rows.Count > 0)
        {
            <div class="col-12">
                <table class="table table-bordered">
                    <colgroup>
                        <col style="width:50%" />
                        <col style="width:30%" />
                        <col style="width:20%" />
                    </colgroup>
                    <thead>
                        <tr>
                            <th>名称</th>
                            <th>信息</th>
                            <th>备注</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in rows)
                        {
                            <tr>
                                <td>
                                    @if (item.DrType == "draw")
                                    {
                                        <span title="绘图" class="mr-2 badge badge-primary">Draw</span>
                                    }
                                    else
                                    {
                                        <span title="思维导图" class="mr-2 badge badge-success">Mind</span>
                                    }
                                    @if (item.DrOpen == 2)
                                    {
                                        <i class="fa fa-lock text-success mr-1" title="私有"></i>

                                        if (!string.IsNullOrWhiteSpace(item.Spare1))
                                        {
                                            <a href="/draw/code/@(item.DrId+"/?code="+item.Spare1)" target="_blank" class="fa fa-share-alt mr-1" title="分享码查看链接"></a>
                                        }
                                    }
                                    <a href="/draw/code/@item.DrId">@item.DrName</a>
                                    @if (uinfo.UserId == item.Uid)
                                    {
                                        <span class="ml-2 stool">
                                            <a href="/draw/code/form/@item.DrId" class="fa fa-fw fa-edit" title="编辑"></a>
                                            <a href="/draw/code/del/@item.DrId" class="fa fa-fw fa-trash-o text-danger" title="删除" onclick="return confirm('确定删除?')"></a>
                                        </span>
                                    }
                                </td>
                                <td>
                                    <i class="fa fa-user text-muted"></i>
                                    <a href="/draw/user/@item.Uid">@item.Spare3</a>
                                    &nbsp;
                                    <span class="text-muted small">
                                        @item.DrCreateTime?.ToString("yyyy-MM-dd HH:mm")
                                    </span>
                                </td>
                                <td>@item.DrRemark</td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            <div class="col-12">
                <partial name="_PartialPaging4" model="Model" />
            </div>
        }
    </div>
</div>